<?php
/*
 * Copyright (c) 2008, 2009 Conor McDermottroe
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, 
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of any contributors to the 
 *    software may be used to endorse or promote products derived from this 
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */
/* XXX Autogenerated - do not edit XXX*/
/**	@package vBulletinAPI
 *	@filesource
 */

/** Base data class. */
require_once("DataObject.php");

/** A query object for the search function.
 *
 *	@property	array $keywords 			Keywords to search for.
 *	@property	User $byUser				Restrict results to this user.
 *	@property	DateTime $minDate			The earliest date/time to search
 *											for.
 *	@property	DateTime $maxDate			The latest date/time to search for.
 *	@property	int $minReplies 			The minimum number of replies that
 *											must be in the thread containing
 *											each returned post.
 *	@property	int $maxReplies 			The maximum number of replies that
 *											must be in the thread containing
 *											each returned post.
 *	@property	string $tag 				Restrict results to posts with this
 *											tag.
 *	@property	array $forums				Restrict results to posts within
 *											these forums.
 *	@property	boolean $includeChildForums If results have been restricted
 *											using the forums property, set this
 *											to true to include children of
 *											those forums in the search.
 *	@property	User $user					The user who is making the search.
 *	@property	boolean $resultsAsThreads	True if the results should be
 *											returned as threads, false if they
 *											should be returned as posts.
 *	@package	vBulletinAPI
 */
class SearchQuery
extends DataObject
{
	/** Create a new {@link SearchQuery}.
	 *
	 *	@param	array $keywords 			Keywords to search for.
	 *	@param	User $byUser				Restrict results to this user.
	 *	@param	DateTime $minDate			The earliest date/time to search
	 *										for.
	 *	@param	DateTime $maxDate			The latest date/time to search for.
	 *	@param	int $minReplies 			The minimum number of replies that
	 *										must be in the thread containing
	 *										each returned post.
	 *	@param	int $maxReplies 			The maximum number of replies that
	 *										must be in the thread containing
	 *										each returned post.
	 *	@param	string $tag 				Restrict results to posts with this
	 *										tag.
	 *	@param	array $forums				Restrict results to posts within
	 *										these forums.
	 *	@param	boolean $includeChildForums If results have been restricted
	 *										using the forums property, set this
	 *										to true to include children of
	 *										those forums in the search.
	 *	@param	User $user					The user who is making the search.
	 *	@param	boolean $resultsAsThreads	True if the results should be
	 *										returned as threads, false if they
	 *										should be returned as posts.
	 */
	public function __construct($keywords = array(), User $byUser = NULL, DateTime $minDate = NULL, DateTime $maxDate = NULL, $minReplies = 0, $maxReplies = PHP_INT_MAX, $tag = "", $forums = array(), $includeChildForums = TRUE, User $user = new User(0), $resultsAsThreads = TRUE) {
		$this->data['keywords'] = $keywords;
		$this->type['keywords'] = "array";
		$this->data['byUser'] = $byUser;
		$this->type['byUser'] = "User";
		$this->data['minDate'] = $minDate;
		$this->type['minDate'] = "DateTime";
		$this->data['maxDate'] = $maxDate;
		$this->type['maxDate'] = "DateTime";
		$this->data['minReplies'] = $minReplies;
		$this->type['minReplies'] = "int";
		$this->data['maxReplies'] = $maxReplies;
		$this->type['maxReplies'] = "int";
		$this->data['tag'] = $tag;
		$this->type['tag'] = "string";
		$this->data['forums'] = $forums;
		$this->type['forums'] = "array";
		$this->data['includeChildForums'] = $includeChildForums;
		$this->type['includeChildForums'] = "boolean";
		$this->data['user'] = $user;
		$this->type['user'] = "User";
		$this->data['resultsAsThreads'] = $resultsAsThreads;
		$this->type['resultsAsThreads'] = "boolean";
	}

	/** Default values for the properties. These will be used to minimise the 
	 *	data to be sent over the wire.
	 *
	 *	@return	array	Default values for properties which have them.
	 */
	protected function defaultPropertyValues() {
		return array(
			"keywords" => array(),
			"byUser" => NULL,
			"minDate" => NULL,
			"maxDate" => NULL,
			"minReplies" => 0,
			"maxReplies" => PHP_INT_MAX,
			"tag" => "",
			"forums" => array(),
			"includeChildForums" => TRUE,
			"user" => new User(0),
			"resultsAsThreads" => TRUE,
		);
	}
}
?>
